//
//  HOAssistantEntity.m
//  WeiDu
//
//  Created by foguo-mac-1 on 14/12/2017.
//  Copyright © 2017 WeiDu. All rights reserved.
//

#import "HOAssistantEntity.h"
#import "HOConstants.h"
#import "HOUtils.h"

@implementation HOAssistantEntity

- (id)init
{
	if(self = [super init])
	{
		self.commentEntity = [[[HOCommentEntity alloc] init] autorelease];
	}
	return self;
}
- (void)parseDic:(NSDictionary *)dic
{
	self.assistantUid = [[HOUtils getValideString:[dic objectForKey:kHO_FIELD_AssistantUid]] intValue];
	self.departmentId = [[HOUtils getValideString:[dic objectForKey:kHO_FIELD_DepartmentId]] intValue];
	self.status = [[HOUtils getValideString:[dic objectForKey:kHO_FIELD_Status]] intValue];
	self.telephone = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_Telephone]];
	self.trueName = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_TrueName]];
	self.headPic = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_Headpic]];
	self.updateTime = [[HOUtils getValideString:[dic objectForKey:kHO_FIELD_UpdateTime]] intValue];
	self.departmentId = [[HOUtils getValideString:[dic objectForKey:kHO_FIELD_DepartmentId]] intValue];
	self.departmentName = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_DepartmentName]];
	self.orderId = [[HOUtils getValideString:[dic objectForKey:kHO_FIELD_OrderId]] intValue];
	self.telephone = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_Telephone]];
	
	self.virtualCellPhone = [HOUtils getValideString:[dic objectForKey:kHO_FIELD_VirtualCellPhone]];
	self.isWorking = [[HOUtils getValideString:[dic objectForKey:kHO_FIELD_WorkStatus]] intValue] == 1; //1在线，2离线;
	NSDictionary *commentDic = [dic objectForKey:kHO_FIELD_Comment];
	if(commentDic != nil)
	{
		self.commentEntity.content = [HOUtils getValideString:[commentDic objectForKey:kHO_FIELD_Content]];
//		self.commentEntity.content = @"hahahahah ahaha 打开了辅导教师来看浮点数";
		self.commentEntity.createTime = [[HOUtils getValideString:[commentDic objectForKey:kHO_FIELD_CreateTime]] intValue];
	}
							
}

- (BOOL)isDepartmentId
{
	return self.assistantUid == 0;
}

- (int)getId
{
	if(self.assistantUid > 0)
		return self.assistantUid;
	return self.departmentId;
}

@end
